mob
	player
		Login()
			..()
			spawn()
				get_highscore()

		Logout()
			..()
			src.highscore_medals()
			del src

		Del()
			src.highscore_medals()
			return ..()

		var
			your_highscore = 0
			game_highscore = 0

		proc
			highscore_medals()
				src.set_highscore()
				src.give_medals()

			set_highscore()
				if(playing > 0)
					// Change the Score and Pet fields
					if(score > my_current_score())
						var/params = list("Score"=score)
						world.SetScores("[key]", list2params(params))

			my_current_score()
				var/scores = world.GetScores(key)
				if(scores)
					var/list/params = params2list(scores)
					if(params["Score"])
						return text2num(params["Score"])
				return 0

			world_highscore()
				var/top_scores = world.GetScores(1,"Score")
				if(top_scores)
					var/list/params = params2list(top_scores)
					return text2num(params[params[1]])
				return 0

			get_highscore()
				spawn()
					your_highscore = my_current_score()
					game_highscore = world_highscore()
					winset(src, "game.label_your_highscore", "text=[your_highscore]")
					winset(src, "game.label_game_highscore", "text=[game_highscore]")
					winset(src, "menu.lbl_status", "text=Ready")
					winset(src, "menu.btn_play", "is-disabled=false")

			give_medals()
				if(playing > 0)
					if(score > game_highscore)
						world.SetMedal("Number 1",src)

					if(score > 9000)
						world.SetMedal("Over 9000",src)

					if(fuel >= max_fuel - 10)
						world.SetMedal("Unlimited fuel",src)

					if(fuel > 0 && fuel < 10)
						world.SetMedal("Running on empty",src)

					if(findtext("[score]","42") == 1)
						world.SetMedal("The Answer",src)

					if(life >= 10)
						world.SetMedal("Stuck alive",src)

					if(fuel_got> 100)
						world.SetMedal("Petrol Station",src)

					if(a_count + f_count > 10000)
						world.SetMedal("Counting Sheep",src)